import ObjectSearch from "@/models/core/ObjectSearch";
import {ExecuteResult} from "@/models/domain/ExecuteResult";
import dayjs, {Dayjs} from "dayjs";
import {Consts} from "@/core/Consts";

export default class JobParam extends ObjectSearch {
    public start: string = dayjs().format(Consts.dateFormat)
    public end: string = dayjs().add(1, 'day').format(Consts.dateFormat);
    public calendar?: number;
    public job?: number;
    public result?: ExecuteResult;

    public get range(): [Dayjs, Dayjs] {
        return [dayjs(this.start), dayjs(this.end)];
    }

    public set range(value: [Dayjs, Dayjs]) {
        this.start = value[0].format(Consts.dateFormat);
        this.end = value[1].format(Consts.dateFormat);
    }
}